module.exports = {
  // 图片转base64方法
  getBase64(file) {
    return new Promise(function (resolve, reject) {
      let reader = new FileReader(); // 上传文件域
      let imgResult = "";
      reader.readAsDataURL(file);
      reader.onload = function () {
        imgResult = reader.result;
      };
      reader.onerror = function (error) {
        reject(error);
      };
      reader.onloadend = function () {
        resolve(imgResult);
      };
    });
  }
}
